const { contextBridge, ipcRenderer } = require('electron')

// 向渲染进程暴露API
contextBridge.exposeInMainWorld('electronAPI', {
  // 提醒相关
  showAlert: (alertData) => ipcRenderer.send('show-alert', alertData),
  closeAlert: (alertId) => ipcRenderer.send('close-alert', alertId),
  onAlertClosed: (callback) => ipcRenderer.on('alert-closed', callback),

  // 心跳相关
  sendHeartbeatStatus: (status) => ipcRenderer.send('heartbeat-status', status),
  onHeartbeatStatus: (callback) => ipcRenderer.on('heartbeat-status', callback),

  // 窗口控制
  minimizeWindow: () => ipcRenderer.send('minimize-window'),
  maximizeWindow: () => ipcRenderer.send('maximize-window'),
  closeWindow: () => ipcRenderer.send('close-window')
})
